<?php
	include("/../data.php");
	session_start();
	if(($_SESSION['db_is_logged_in'] == false) || ($_SESSION['profile'] != 'admin'))
		header("location:index.php");
	
	$pass = "";	
	$connect=mysql_connect($DatabaseServer,$DatabaseUsername,$DatabasePassword) or die("can't connect this database");
	mysql_select_db($DatabaseName,$connect);
    $sql="select * from staff where username='".$_SESSION['username'] ."'";
    $query=mysql_query($sql);
	
	if(mysql_num_rows($query)==0) {
			header("location:index.php");     
    } 
	else{
		$row=mysql_fetch_array($query);         
		$pass = $row["password"];
	}
	
	if(isset($_COOKIE['InputUsername'])){
		if( ($_SESSION['db_is_logged_in'] == true) && ( $_COOKIE["InputUsername"]!=$pass))
		{
			//header("location:index.php");
		}
	}
	
	if( ($_SESSION['db_is_logged_in'] == true)&&( $_SESSION['password']!=$pass))
	{
		header("location:index.php");
	}
?>

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Import</title>
	
    <link href="css/bootstrap.min.css" rel="stylesheet">
	<link href="css/signin.css" rel="stylesheet">

  </head>
  <body>

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
    <script src="js/bootstrap.min.js"></script>
	
	
	<div class="container">
	 
		<h1 align="center"><span class="label label-info">NHẬP DỮ LIỆU TỪ EXCEL VÀO DATABASE</span></h1>
		<h4 align="center"><span class="label label-info"><i>(Dữ liệu thông tin giảng viên)</i></span></h4>
		<br/>
		<br/>
		
		
		<form action="helper/helper_teacher.php" method="post" enctype="multipart/form-data" class="form-signin" role="form">
			<div style="position:relative;">
				<a class='btn btn-primary' href='javascript:;'>
					Chọn tập tin...
					<input type="file" name="file" id="file" style='position:absolute;z-index:2;top:0;left:0;filter: alpha(opacity=0);-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";opacity:0;background-color:transparent;color:transparent;' name="file_source" size="40"  onchange='$("#upload-file-info").html($(this).val());'>
				</a>
				&nbsp;
				<span class='label label-info' id="upload-file-info"></span>
			</div>
			</br>
			
			
			<button class="btn btn-success" type="submit" name="submit">Lưu vào database</button>
		</form>
    </div>
  </body>
</html>